package logic

import (
	"context"
	"video-management-system/model"

	"video-management-system/userrpc/internal/svc"
	"video-management-system/userrpc/userrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type VideoShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewVideoShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VideoShowLogic {
	return &VideoShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 视频详情统计
func (l *VideoShowLogic) VideoShow(in *userrpc.VideoShowRequest) (*userrpc.VideoShowResponse, error) {
	// todo: add your logic here and delete this line
	var video model.VideoInfo
	show := video.VideoShow(model.DB, in.Vid)
	return &userrpc.VideoShowResponse{
		Nickname:      show.Nickname,
		VideoTitle:    show.VideoTitle,
		VideoCategory: show.VideoCategory,
		VideoLink:     show.VideoLink,
		CoverLink:     show.CoverLink,
		VideoIntro:    show.VideoIntro,
	}, nil
}
